# -*- coding: utf-8 -*-

class cLocation():
    def __init__(self, x, y):
        self.x = x
        self.y = y
    def Distance(self, another):
        res = abs(another.x - self.x) + abs(another.y - self.y)
        return res
    def Move(self, another):
        return cLocation(self.x+another.x,  self.y+another.y)
    def MoveInv(self, another):
        return cLocation(self.x-another.x,  self.y-another.y)
    def IfOut(self, row, column):
        if self.x < 0 or self.y < 0 or self.x >= row or self.y >= column:
            return True
        return False
    def IsIn(self, otherList):
        for elem in otherList:
            if self.x == elem.x and self.y == elem.y:
                return True
        return False
